package com.net.framework.help.widget.imageview;

import android.content.Context;
import android.graphics.Canvas;
import android.util.AttributeSet;
import android.widget.ImageView;

/**
 * @author zhangxiaobin
 * @version V1.0
 * @ClassName: BlackShadeImgeView.java
 * @email 154722566@qq.com
 * @Date 2016年2月27日 上午10:57:46
 * @Description: 图片点击时黑色透明效果imageview
 */
public class BlackShadeImgeView extends ImageView {

    public BlackShadeImgeView(Context context) {
        super(context);
        // TODO Auto-generated constructor stub
    }

    public BlackShadeImgeView(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
        // TODO Auto-generated constructor stub
    }

    public BlackShadeImgeView(Context context, AttributeSet attrs) {
        super(context, attrs);
        // TODO Auto-generated constructor stub
    }

    @Override
    protected void onDraw(Canvas canvas) {
        // TODO Auto-generated method stub
        super.onDraw(canvas);
        if (isPressed())
            canvas.drawColor(0x11000000);
    }

    @Override
    protected void dispatchSetPressed(boolean pressed) {
        // TODO Auto-generated method stub
        super.dispatchSetPressed(pressed);
        invalidate();
    }
}